import math


nums = [0,1,3]
i = 0
j = len(nums) - 1
num = nums[i] + nums[j]
while nums[j] + nums[i] == num and i < j:
    j -= 1
    i += 1
print(i,j)
if nums[j] + nums[i]!=num:
    if nums[i]-nums[i-1]!=1:
        print(nums[i]-1)
    else:
        print(nums[j] + 1)
else:
    print(abs(nums[i]-nums[j]))
# def ind(nums):
#     if len(nums)<=3:
#         return nums
#     else:
#         middle = len(nums) // 2
#         left = 0
#         right = len(nums) - 1
#         if len(nums[left:middle]) != nums[middle - 1] - nums[left]+1:
#             right, left = middle, left
#             nums = nums[left:right+1]
#             return ind(nums)
#         else :
#             right,left = right, middle
#             nums = nums[left:right+1]
#             return ind(nums)
# print(ind(nums))